/**
 * 
 */
package com.huarui.desktop.model;

import java.util.List;

import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;

/**
 * @author peng.sunp
 * 
 */
public class DesktopJsModule extends JsModule {

	private Integer id;
	private Integer desktopId;
	private Integer jsModuleId;
	private boolean inShortcut;
	private boolean inQuickstart;
	private boolean autorun;
	private Integer shortcutSeq;
	private Integer quickstartSeq;
	private boolean markTask;
	private List<Integer> menuIds;

	private static final String[] excludeProperties = { "id", "permissionId", "desktopId", "jsModuleId", "autorun", "inQuickstart", "inShortcut", "shortcutSeq", "auickstarSeq" };
	private static JsonConfig jsonConfig;
	static {
		jsonConfig = new JsonConfig();
		jsonConfig.setExcludes(excludeProperties);
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getDesktopId() {
		return desktopId;
	}

	public void setDesktopId(Integer desktopId) {
		this.desktopId = desktopId;
	}

	public Integer getJsModuleId() {
		return jsModuleId;
	}

	public void setJsModuleId(Integer jsModuleId) {
		this.jsModuleId = jsModuleId;
	}

	public boolean isInShortcut() {
		return inShortcut;
	}

	public void setInShortcut(boolean inShortcut) {
		this.inShortcut = inShortcut;
	}

	public boolean isInQuickstart() {
		return inQuickstart;
	}

	public void setInQuickstart(boolean inQuickstart) {
		this.inQuickstart = inQuickstart;
	}

	public boolean isAutorun() {
		return autorun;
	}

	public void setAutorun(boolean autorun) {
		this.autorun = autorun;
	}

	public Integer getShortcutSeq() {
		return shortcutSeq;
	}

	public void setShortcutSeq(Integer shortcutSeq) {
		this.shortcutSeq = shortcutSeq;
	}

	public Integer getQuickstartSeq() {
		return quickstartSeq;
	}

	public void setQuickstartSeq(Integer quickstartSeq) {
		this.quickstartSeq = quickstartSeq;
	}

	public boolean isMarkTask() {
		return markTask;
	}

	public void setMarkTask(boolean markTask) {
		this.markTask = markTask;
	}

	public List<Integer> getMenuIds() {
		return menuIds;
	}

	public void setMenuIds(List<Integer> menuIds) {
		this.menuIds = menuIds;
	}

	public boolean equals(Object object) {
		if (this == object) {
			return true;
		}
		if (object instanceof Module) {
			Module module = (Module) object;
			return this.getId().equals(module.getId());
		}
		return false;
	}

	public int hashCode() {
		return this.getId() == null ? 0 : this.getId().hashCode();
	}

	public String toString() {
		JSONObject jsonObject = JSONObject.fromObject(this, jsonConfig);
		// 把moduleId换成id,以支持js少变化
		jsonObject.put("id", this.getModuleId());
		return jsonObject.toString();
	}
}
